import { useMessage } from 'wot-design-uni'
import { useUserStore } from '@/store'
import { uniNavigateTo } from '@/utils'

const message = useMessage()

export function useLoginMessage(path) {
  console.log('useUserStore().isLogined', useUserStore().isLogined)
  if (useUserStore().isLogined) {
    uniNavigateTo(path)
  } else {
    message
      .confirm({
        msg: '您还未登录，是否去登录？',
        title: '提示',
      })
      .then(() => {
        uniNavigateTo('/pages/login/index')
      })
      .catch(() => {
        console.log('点击了取消按钮')
      })
  }
}
